package com.guodi.model.controller;



import com.guodi.model.entity.ApiIndicatorsVal;
import com.guodi.model.entity.ApiUeProblemRecords;
import com.guodi.model.entity.UeProblemRecords;
import com.guodi.model.vo.UeProjectMangerVo;
import org.springframework.web.bind.annotation.RequestMapping;
import com.guodi.core.tool.api.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;


import org.springframework.web.bind.annotation.RestController;
import com.guodi.core.boot.ctrl.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import com.guodi.model.service.IUeProblemRecordsService;
import org.springframework.validation.annotation.Validated;

import java.util.List;


/**
* 项目关联问题记录表 前端控制器
* @author lzy
* @date 2023-08-09
*/
@Slf4j
@Validated
@RestController
@RequestMapping("/UeProblemRecords")
@Api(value = "API - UeProblemRecordsController", tags = "项目关联问题记录表")
public class UeProblemRecordsController extends BaseController {

    @Resource
    private IUeProblemRecordsService ueProblemRecordsService;


    /**
     * @描述: 查询列表
     * @入参:
     * @出参:
     * @作者: lzy
     * @日期: 2023/8/22 16:57
     **/
    @PostMapping("/listByEntity")
    @ApiOperation(value = "查询列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "divisionCode", value = "行政区划", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "关键字", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "状态", required = false, dataType = "String", paramType = "query")
    })
    public R listByEntity(String year, String divisionCode, String name, String status) {
        List<UeProblemRecords> list = this.ueProblemRecordsService.listByEntity(year,divisionCode,name,status);
        return R.data(list);
    }



    /**
     * @描述: 查询基本信息列表
     * @入参:
     * @出参:
     * @作者: lzy
     * @日期: 2023/8/22 17:46
     **/
    @PostMapping("/getListByProblemId")
    @ApiOperation(value = "查询基本信息列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "problemId", value = "关联问题场景id", required = true, dataType = "String", paramType = "query")
    })
    public R getListByProblemId(String problemId) {
        List<ApiUeProblemRecords> list = this.ueProblemRecordsService.getListByProblemId(problemId);
        return R.data(list);
    }


    /**
     * @描述: 查询项目列表
     * @入参:
     * @出参:
     * @作者: lzy
     * @日期: 2023/8/22 17:46
     **/
    @PostMapping("/getProjectsByProblemId")
    @ApiOperation(value = "查询项目列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "problemId", value = "关联问题场景id", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "divisionCode", value = "行政区划", required = true, dataType = "String", paramType = "query")
    })
    public R getProjectsByProblemId(String problemId, String year, String divisionCode) {
        List<UeProjectMangerVo> list = this.ueProblemRecordsService.getProjectsByProblemId(problemId,year,divisionCode);
        return R.data(list);
    }


    /**
     * @描述: 查询指标列表
     * @入参:
     * @出参:
     * @作者: lzy
     * @日期: 2023/8/22 17:46
     **/
    @PostMapping("/getIndicatorsByProblemId")
    @ApiOperation(value = "查询指标列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "problemId", value = "关联问题场景id", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "divisionCode", value = "行政区划", required = true, dataType = "String", paramType = "query")
    })
    public R getIndicatorsByProblemId(String problemId, String year, String divisionCode) {
        List<ApiIndicatorsVal> list = this.ueProblemRecordsService.getIndicatorsByProblemId(problemId,year,divisionCode);
        return R.data(list);
    }


    /**
     * @描述: 查询指标详情
     * @入参:
     * @出参:
     * @作者: lzy
     * @日期: 2023/8/22 17:46
     **/
    @PostMapping("/getIndicatorsInfo")
    @ApiOperation(value = "查询指标详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "idtId", value = "指标id", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "year", value = "年份", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "startYear", value = "起始年份", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "endYear", value = "结束年份", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "divisionCode", value = "区域代码(多个用逗号隔开)", required = true, dataType = "string", paramType = "query")
    })
    public R getIndicatorsInfo(String idtId, String year, String divisionCode, String startYear, String endYear) {
        List<ApiIndicatorsVal> list = this.ueProblemRecordsService.getIndicatorsInfo(idtId,year,divisionCode,startYear,endYear);
        return R.data(list);
    }


}
